1 /* 2 * This file is part of gtkD. 3 * 4 * gtkD is free software; you can redistribute it and/or modify 5 * it under the terms of the GNU Lesser General Public License 6 * as published by the Free Software Foundation; either version 3 7 * of the License, or (at your option) any later version, with 8 * some exceptions, please read the COPYING file. 9 * 10 * gtkD is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU Lesser General Public License for more details. 14 * 15 * You should have received a copy of the GNU Lesser General Public License 16 * along with gtkD; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA 18 */ 19 20 // generated automatically - do not change 21 // find conversion definition on APILookup.txt 22 // implement new conversion functionalities on the wrap.utils pakage 23 24 25 module gtk.ScrollableT; 26 27 public import glib.MemorySlice; 28 public import gobject.ObjectG; 29 public import gtk.Adjustment; 30 public import gtk.Border; 31 public import gtk.c.functions; 32 public import gtk.c.types; 33 34 35 /** 36 * `GtkScrollable` is an interface for widgets with native scrolling ability. 37 * 38 * To implement this interface you should override the 39 * [property@Gtk.Scrollable:hadjustment] and 40 * [property@Gtk.Scrollable:vadjustment] properties. 41 * 42 * ## Creating a scrollable widget 43 * 44 * All scrollable widgets should do the following. 45 * 46 * - When a parent widget sets the scrollable child widget’s adjustments, 47 * the widget should connect to the [signal@Gtk.Adjustment::value-changed] 48 * signal. The child widget should then populate the adjustments’ properties 49 * as soon as possible, which usually means queueing an allocation right away 50 * and populating the properties in the [vfunc@Gtk.Widget.size_allocate] 51 * implementation. 52 * 53 * - Because its preferred size is the size for a fully expanded widget, 54 * the scrollable widget must be able to cope with underallocations. 55 * This means that it must accept any value passed to its 56 * [vfunc@Gtk.Widget.size_allocate] implementation. 57 * 58 * - When the parent allocates space to the scrollable child widget, 59 * the widget must ensure the adjustments’ property values are correct and up 60 * to date, for example using [method@Gtk.Adjustment.configure]. 61 * 62 * - When any of the adjustments emits the [signal@Gtk.Adjustment::value-changed] 63 * signal, the scrollable widget should scroll its contents. 64 */ 65 public template ScrollableT(TStruct) 66 { 67 /** Get the main Gtk struct */ 68 public GtkScrollable* getScrollableStruct(bool transferOwnership = false) 69 { 70 if (transferOwnership) 71 ownedRef = false; 72 return cast(GtkScrollable*)getStruct(); 73 } 74 75 76 /** 77 * Returns the size of a non-scrolling border around the 78 * outside of the scrollable. 79 * 80 * An example for this would be treeview headers. GTK can use 81 * this information to display overlaid graphics, like the 82 * overshoot indication, at the right position. 83 * 84 * Params: 85 * border = return location for the results 86 * 87 * Returns: %TRUE if @border has been set 88 */ 89 public bool getBorder(out Border border) 90 { 91 GtkBorder* outborder = sliceNew!GtkBorder(); 92 93 auto __p = gtk_scrollable_get_border(getScrollableStruct(), outborder) != 0; 94 95 border = ObjectG.getDObject!(Border)(outborder, true); 96 97 return __p; 98 } 99 100 /** 101 * Retrieves the `GtkAdjustment` used for horizontal scrolling. 102 * 103 * Returns: horizontal `GtkAdjustment`. 104 */ 105 public Adjustment getHadjustment() 106 { 107 auto __p = gtk_scrollable_get_hadjustment(getScrollableStruct()); 108 109 if(__p is null) 110 { 111 return null; 112 } 113 114 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) __p); 115 } 116 117 /** 118 * Gets the horizontal `GtkScrollablePolicy`. 119 * 120 * Returns: The horizontal `GtkScrollablePolicy`. 121 */ 122 public GtkScrollablePolicy getHscrollPolicy() 123 { 124 return gtk_scrollable_get_hscroll_policy(getScrollableStruct()); 125 } 126 127 /** 128 * Retrieves the `GtkAdjustment` used for vertical scrolling. 129 * 130 * Returns: vertical `GtkAdjustment`. 131 */ 132 public Adjustment getVadjustment() 133 { 134 auto __p = gtk_scrollable_get_vadjustment(getScrollableStruct()); 135 136 if(__p is null) 137 { 138 return null; 139 } 140 141 return ObjectG.getDObject!(Adjustment)(cast(GtkAdjustment*) __p); 142 } 143 144 /** 145 * Gets the vertical `GtkScrollablePolicy`. 146 * 147 * Returns: The vertical `GtkScrollablePolicy`. 148 */ 149 public GtkScrollablePolicy getVscrollPolicy() 150 { 151 return gtk_scrollable_get_vscroll_policy(getScrollableStruct()); 152 } 153 154 /** 155 * Sets the horizontal adjustment of the `GtkScrollable`. 156 * 157 * Params: 158 * hadjustment = a `GtkAdjustment` 159 */ 160 public void setHadjustment(Adjustment hadjustment) 161 { 162 gtk_scrollable_set_hadjustment(getScrollableStruct(), (hadjustment is null) ? null : hadjustment.getAdjustmentStruct()); 163 } 164 165 /** 166 * Sets the `GtkScrollablePolicy`. 167 * 168 * The policy determines whether horizontal scrolling should start 169 * below the minimum width or below the natural width. 170 * 171 * Params: 172 * policy = the horizontal `GtkScrollablePolicy` 173 */ 174 public void setHscrollPolicy(GtkScrollablePolicy policy) 175 { 176 gtk_scrollable_set_hscroll_policy(getScrollableStruct(), policy); 177 } 178 179 /** 180 * Sets the vertical adjustment of the `GtkScrollable`. 181 * 182 * Params: 183 * vadjustment = a `GtkAdjustment` 184 */ 185 public void setVadjustment(Adjustment vadjustment) 186 { 187 gtk_scrollable_set_vadjustment(getScrollableStruct(), (vadjustment is null) ? null : vadjustment.getAdjustmentStruct()); 188 } 189 190 /** 191 * Sets the `GtkScrollablePolicy`. 192 * 193 * The policy determines whether vertical scrolling should start 194 * below the minimum height or below the natural height. 195 * 196 * Params: 197 * policy = the vertical `GtkScrollablePolicy` 198 */ 199 public void setVscrollPolicy(GtkScrollablePolicy policy) 200 { 201 gtk_scrollable_set_vscroll_policy(getScrollableStruct(), policy); 202 } 203 }